import { Injectable } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';
import { Model } from 'mongoose';

import { IMessage } from 'src/types/message.interface';

type UnionType = IMessage | IMessage[];

@Injectable()
export class MessageService {

     /**
     * 参数装饰器,MessageTable 这个名字要和app.module.ts中的MongooseModule.forFeature 定义的名字一样
     * MessageTable 是定义好的
     * @param recommendModel 
     */
     constructor(@InjectModel('MessageTable') private messageModel: Model<IMessage>) {

     }

     /**
     * 查询数据
     * @param queryCondition 
     * @returns 
     */
    async getCode(queryCondition?:object) {
        return this.messageModel.find(queryCondition).exec();
    }

    async generateCode(){
        
    }


}
